import request from '@/config/axios'

// 文章评论 VO
export interface ArticleCommentsVO {
  id: number // 主键
  articleId: number // 文章
  userId: number // 用户
  articleName: string // 文章名称
  userName: string // 用户名称
  commentContent: string // 评论
  parentCommentId: number // 上级评论
}

// 文章评论 API
export const ArticleCommentsApi = {
  // 查询文章评论分页
  getArticleCommentsPage: async (params: any) => {
    return await request.get({ url: `/system/article-comments/page`, params })
  },
  adminCountComments: async () => {
    return await request.get({ url: `/system/article-comments/adminCountComments` })
  },

  // 查询文章评论详情
  getArticleComments: async (id: number) => {
    return await request.get({ url: `/system/article-comments/get?id=` + id })
  },

  // 新增文章评论
  createArticleComments: async (data: ArticleCommentsVO) => {
    return await request.post({ url: `/system/article-comments/create`, data })
  },

  // 新增文章评论
  hf: async (data: ArticleCommentsVO) => {
    return await request.post({ url: `/system/article-comments/hf`, data })
  },

  // 修改文章评论
  updateArticleComments: async (data: ArticleCommentsVO) => {
    return await request.put({ url: `/system/article-comments/update`, data })
  },

  // 删除文章评论
  deleteArticleComments: async (id: number) => {
    return await request.delete({ url: `/system/article-comments/delete?id=` + id })
  },

  pzHandle: async (id: number) => {
    return await request.get({ url: `/system/article-comments/pzHandle?id=` + id })
  },

  ljHandle: async (id: number) => {
    return await request.get({ url: `/system/article-comments/ljHandle?id=` + id })
  },

  hszHandle: async (id: number) => {
    return await request.get({ url: `/system/article-comments/hszHandle?id=` + id })
  },

  // 导出文章评论 Excel
  exportArticleComments: async (params) => {
    return await request.download({ url: `/system/article-comments/export-excel`, params })
  }
}
